import request from '@/utils/request'
/**
 * 调拨申请分页查询
 * @param {*} data = {pageNo: 0, pageSize: 0, param: {accidentTypeDictId,storeId,tiltle}}
 */
export function dataList(form, pageSize, currentPage) {
  const data = {
    param: form,
    pageSize: pageSize,
    pageNo: currentPage
  }
  return request.post('/sq/brandAllot/page', data)
}
/**
 * 删除调拨
 * @param {*} iddetail
 */
export function deleteData(id) {
  return request.delete(`/sq/brandAllot/del/${id}`)
}
/**
 * 根据id查询调拨详情
 * @param {*} options
 */
export function details(id) {
  return request.get('/sq/brandAllot/detail/' + id)
}
/**
 * 新增
 * @param {*} options
 */
export function add(options) {
  return request.post('/sq/brandAllot/save', options)
}

/**
 * 编辑
 * @param {*} options
 */
export function update(options) {
  return request.put('/sq/brandAllot/save', options)
}
/**
 * 生成调拨编号
 * @param {*} options
 */
export function getAllotCode() {
  return request.get('/sq/brandAllot/getAllotCode')
}
// 编辑查询
export function getFindById(id) {
  return request.get(`/sq/brandAllot/findById/${id}`)
}
// 根据门店id获取仓库
export function findByStore(storeId) {
  return request.get('/storage/findByStore/' + storeId)
}
// 获取仓位
export function findByStoreIdAndStorageId(storeId, storageId) {
  return request.get(
    '/storageSite/findByStoreIdAndStorageId/' + storeId + '/' + storageId
  )
}
// 获取仓位编号
export function getFindPosDetail(id) {
  return request.get('/storageSite/detail/' + id)
}

// 查看获取调拨订单信息
export function getBaseList(form, pageSize, currentPage, allotId) {
  const data = {
    param: form,
    pageSize: pageSize,
    pageNo: currentPage,
    allotId
  }
  return request.post('/sq/brandAllot/partsPage', data)
}

// 审核通过
export function auditPass(id) {
  return request.put('/sq/brandAllot/pass', { id })
}
// 审核不通过
export function auditUnPass(id,status) {
  return request.put(`/sq/brandAllot/updateStatus`,{id,status})
}
